//
// Created by Ge on 2024/3/5.
//
#ifndef INC_3DMODEL_SIMPLECUBE_H
#define INC_3DMODEL_SIMPLECUBE_H

#include "glm/glm.hpp"
#include <GLES2/gl2.h>
#include "glm/gtc/matrix_transform.hpp"
#include "glm/gtc/type_ptr.hpp"
#include "LogUts.h"
#include "ShareLoader.h"

class SimpleCube {
public:
    char *vertexShaderCode = "attribute vec4 vPosition;\n"
                             "void main() {\n"
                             "  gl_Position = vPosition;\n"
                             "}";
    char *fragmentShaderCode =
            "precision mediump float;\n"
            "void main() {\n"
            "  gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);\n"
            "}";
    //正方体的顶点数据
    GLfloat vertices[24] = {
            -0.5f, -0.5f, -0.5f,
            0.5f, -0.5f, -0.5f,
            0.5f, 0.5f, -0.5f,
            -0.5f, 0.5f, -0.5f,

            -0.5f, -0.5f, 0.5f,
            0.5f, -0.5f, 0.5f,
            0.5f, 0.5f, 0.5f,
            -0.5f, 0.5f, 0.5f
    };
    //顶点索引
    short indices[24] = {
            0, 1, 2, 3, // Front
            4, 5, 6, 7, // Back
            0, 1, 4, 5, // Bottom
            2, 3, 6, 7, // Top
            0, 2, 4, 6, // Left
            1, 3, 5, 7  // Right
    };

    //顶点颜色
    GLfloat colors[32] = {
            1.0f, 0.0f, 0.0f, 1.0f,
            0.0f, 1.0f, 0.0f, 1.0f,
            0.0f, 0.0f, 1.0f, 1.0f,
            0.0f, 1.0f, 0.0f, 1.0f,
            1.0f, 0.0f, 0.0f, 1.0f,
            0.0f, 1.0f, 0.0f, 1.0f,
            0.0f, 0.0f, 1.0f, 1.0f,
            0.5f, 0.5f, 0.5f, 1.0f
    };
    void draw();
};

#endif //INC_3DMODEL_SIMPLECUBE_H
